var express = require('express');
var router = express.Router();
//获取数据库api中get方法
const {get,remove,findOne,getAllUsers,getOne} =require("../api/usersList.js")



router.get('/',async function(req, res, next) {
    const {curPage,eachPage}=req.query;
    const data=await get({curPage,eachPage});
    res.send(data)
});



// 删除电影
router.post('/remove',async function(req, res, next) {
    const{_id}= req.body;
    await remove({_id});
    res.send({status:true})
});

// 通过id查找学生  :表示动态
router.get('/findOne/:_id', async function (req, res, next) {
    // params去做路径解析
    const { _id } = req.params;
    const data = await findOne(_id);
    res.send(data)
});


module.exports=router;
